require 'pathname'

start_dir = '/Users/russelldad/dropbox/Dropbox/backup2009-03-07/controller/app/views/'
end_dir = '/Users/russelldad/Documents/dev/thesis/thesisdev/controller/app/views/'
 
 
  p1 = Pathname(start_dir)
  p1.children.each do |directory|
    if directory.directory? then
      #copy all the files in that directory to the end directory
      directory.children.each do |file|
        from = file.to_s
        to = end_dir + File.basename(directory.to_s) + '/'
        puts 'COPY: ' + from
        puts 'TO: ' + to
        puts system ('cp ' + from + ' ' + to)
      end
    end  
  end
